--Chat Functions--
---By Erathorn----

--Define the Locals--
local DEBUG = true
local BANK = "#bank"
local SETHEARTH = "#sethearth"
local REPAIRALL = "#repairall"
local RELOAD = "#reload"
---------------------
function OnChat(event, plr, message, type, language)
	if(plr:GetGmRank() == "az") then
		if(message == RELOAD) then
			ReloadLuaEngine()
			return 0
		end
		if(message == BANK) then
			plr:SendBankWindow(plr)
			return 0
		end
		if(message == SETHEARTH) then
			plr:SetBindPoint(plr:GetX(), plr:GetY(), plr:GetZ(), plr:GetMapId(), plr:GetZoneId())
			if(DEBUG == true) then
			plr:SendBroadcastMessage("You are now bound to this location. [X:"..plr:GetX().." | Y:"..plr:GetY().." | Z:"..plr:GetZ().."|")
			else
			plr:SendBroadcastMessage("You are now bound to this location.")
			end
			if(plr:HasItem(6948) == false) then
				plr:AddItem(6948, 1)
			end
			return 0
		end
		if(message == REPAIRALL) then
			plr:RepairAllPlayerItems()
			plr:SendBroadcastMessage("All items repaired on "..plr:GetName().."!")
			return 0
		end	
	end
end

function OnLevel(event, plr)
	if(plr:GetLevel() == 15) then
		plr:SendBroadcastMessage("You have gained 75 Riding Skill!")
		plr:AddSkill(762, 75, 75)
	end
	
	if(plr:GetLevel() == 20) then
		plr:SendBroadcastMessage("You have gained the 150 Riding Skill!")
		plr:RemoveSkill(762)
		plr:AddSkill(762, 150, 150)
	end
end
---------------------
RegisterServerHook(16, "OnChat")
RegisterServerHook(27, "OnLevel")